package com.ryan.route.controller.front;

import com.ryan.route.entity.TravelAdvisor;
import com.ryan.route.entity.TravelRoute;
import com.ryan.route.service.TravelAdvisorService;
import com.ryan.route.service.TravelRouteService;
import com.ryan.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/route/front")
public class FrontIndexController {

    @Autowired
    private TravelRouteService routeService;

    @Autowired
    private TravelAdvisorService advisorService;

    /**
     * 获取前8条热门路线
     * @return
     */
    @GetMapping("/getIndexRoute")
    public R getIndexRoute(){
        List<TravelRoute> routeList = routeService.getIndexRoute();
        return R.ok().data("routeList", routeList);
    }

    @GetMapping("/getIndexAdvisor")
    public R getIndexAdvisor(){
        List<TravelAdvisor> advisorList = advisorService.getIndexAdvisor();
        return R.ok().data("advisorList", advisorList);
    }

}
